Skip to content

concore.write: convert numpy arrays to plain lists - #707

Open
yadavchiragg wants to merge 1 commit into
ControlCore-Project:devfrom
yadavchiragg:fix/write-numpy-arrays
Open

yadavchiragg wants to merge 1 commit into
ControlCore-Project:devfrom
yadavchiragg:fix/write-numpy-arrays

Conversation

@yadavchiragg

Copy link
Copy Markdown

Fixes #706

concore.write() only converted numpy scalars, so arrays either produced nothing or unreadable output:

  • a bare np.ndarray was rejected ("must have list or str value") and nothing was written
  • an array inside a list was written as "array([...])", which literal_eval and the other runtimes cannot parse
  • on ZMQ ports arrays failed JSON serialization

convert_numpy_to_python now converts np.ndarray with tolist(), and write() turns a bare array into a list of its values. Existing list/tuple/scalar behaviour is unchanged.

Added tests/test_write_numpy_arrays.py (file bare array, array in list, 2-D array, converter, ZMQ); all fail without the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant